﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataLayer;

namespace CtrLayer
{
    public class PersonCtrl
    {
        private UCNArtDataContext _db = DBCon.GetDB();


        public int Login(String userName, String password)
        {
            Person user = _db.Persons.SingleOrDefault(p => p.UserName == userName);
            if (user != null && user.Password == password && user.AuthrisationLevel == "Admin")
            {
                return 2;
            }
            else if (user != null && user.Password == password && user.AuthrisationLevel == "Bruger")
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
    }
}
